#pragma once

#include "IRenderer.h"

IRenderer* IRenderer::m_Instance(0);
IRenderer::IRenderer(void)
{
	m_activeShader = -1;
	m_activeTexture = -1;
	m_projectionStack.push(Maths::Matrix());
	m_modelViewStack.push(Maths::Matrix());
}
IRenderer::~IRenderer(void)
{
	m_window->Destroy();
}
IRenderer* IRenderer::Instance()	
{
	return m_Instance;
}
unsigned int& IRenderer::getShadeModel()
{
	return m_shadeModel;
}
std::vector<float>& IRenderer::getClearColor()
{
	return m_clearColor;
}
float& IRenderer::getClearDepthValue()
{
	return m_clearDepthValue;
}
bool& IRenderer::getDepthTest()
{
	return m_depthTest;
}
unsigned int& IRenderer::getDepthFunc()
{
	return m_depthFunc;
}
std::vector<unsigned int>& IRenderer::getHints()
{
	return m_hints;
}
std::string& IRenderer::getWindowTitle()
{
	return m_windowTitle;
}
unsigned int& IRenderer::getWindowWidth()
{
	return m_windowWidth;
}
unsigned int& IRenderer::getWindowHeight()
{
	return m_windowHeight;
}

Pointer<IWindow>& IRenderer::getWindow()
{
	return m_window;
}

#pragma region Matrix_Functions
void IRenderer::PushProjectionMatrix( Maths::Matrix& matrix )
{
	m_projectionStack.push(matrix * m_projectionStack.top());
}
void IRenderer::PushModelViewMatrix( Maths::Matrix& matrix )
{	
	m_modelViewStack.push(matrix * m_modelViewStack.top());
}
void IRenderer::PopProjectionMatrix( )
{
	m_projectionStack.pop();
}
void IRenderer::PopModelViewMatrix()
{	
	m_modelViewStack.pop();
}
Maths::Matrix& IRenderer::ProjectionMatrix()
{
	return m_projectionStack.top();
}
Maths::Matrix& IRenderer::ModelViewMatrix()
{
	return m_modelViewStack.top();
}
#pragma endregion
Shader& IRenderer::getShader( HashedString& name )
{
	return m_shaders[name];
}